<include file="Public/head" />
<style type="text/css">
    .box{width:186px; height:210px;margin:10px auto;float: left;margin-left: 6px; position:relative;}
    .box-title{ position:absolute;left:14px;top:100px;height:30px; line-height:30px;width:157px; text-align:center;color:#fff; z-index:99;}
    .sunbox{width:156px; height:120px;margin:10px auto; overflow:hidden; background:url(http://img1.isou365.cn/paimai/yunying/images/tupianBg.jpg) no-repeat;}
    .shangchuan{position: relative;overflow: hidden;display:inline-block;*display:inline;padding:4px 10px 4px;font-size:14px;line-height:18px;*line-height:20px;color:#fff;text-align:center;vertical-align:middle;cursor:pointer;background-color:#5bb75b;border:none;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;}
    .shangchuan input {position: absolute;top: 0; right: 0;margin: 0;border:none;opacity: 0;filter:alpha(opacity=0); cursor: pointer;}
    .files{}
    .delimg{height:18px; line-height:18px; position:absolute;top:5px;right:5px;width:18px;border-radius:50%; background:#20ab4f;color:#fff; text-align:center;cursor:pointer;}
    /*.delimg{height:18px; line-height:18px;color:#fff; cursor:pointer;font-size:14px;}*/
    .box .box-title-bg{ position:absolute;left:14px;top:100px;height:30px; line-height:30px;width:157px; background:#000; opacity:0.5;}
    .sunbox-alret{ display:none; position:fixed;top:50%;left:50%; background:#fff;border-radius:5px;z-index:999;padding:20px;}
    .sunbox-alret span{height:18px; line-height:18px; position:absolute;top:-5px;right:-5px;width:18px;border-radius:50%; background:#20ab4f;color:#fff; text-align:center;z-index:999; cursor: pointer;}
    .sunbox-alret .xie-loading{cursor:pointer;position: absolute;top:50%;left:50%;margin:-25px 0 0 -25px;width:50px;height:50px; display:none;}
    .sunbox-alret .xie-loading img{width:50px;height:50px; display: block;}
    .box-plus{width:156px;height:120px; line-height:120px; text-align: center;color:#d3d9d9;font-size:60px; display:block; background:#fff;border:solid 2px #d3d9d9;margin-top:10px; cursor:pointer;}
    .xuanzhe {margin-top: 0px;width: 976px;}
    .xuanzhe .span_right{width: 80px;text-align: right;}
    .xuanzhe ul li{margin-bottom: 5px;}
    .xuanzhe ul li span {text-align: left;}
    .xuanzhe ul li .menDao1{width:300px;}
    .xuanzhe ul li .menDao1 a{display:block;background:#cecece;color:#303030;float:left;width:36px; text-align:center;height:20px; line-height:20px; cursor:pointer;}
    .xuanzhe ul li .menDao1 .menHover{ background:#20ab4f;color:#fff;}
    .xuanzhe .lift-truck{width:280px;padding:10px;display:block; background:#e1e1e1;border-radius:5px;margin-left:140px;margin-top:-10px;}
    .xuanzhe .lift-truck #taker_phone,.xuanzhe .lift-truck #taker_sex,.xuanzhe .lift-truck #taker_card,.xuanzhe .lift-truck #take_car_num{width:280px; display:block;height:30px; line-height:30px; text-align:left;}
    .xuanzhe .lift-truck span em{float:left; display:block;width:60px; text-align:right;}
    .yt_total{height:50px;line-height: 50px;width: 60%;border-top:1px solid #ccc;margin: 3% 0 0 3%;text-align:left;}
    .progress { position: relative;
        margin-left: 42px;
        margin-top: -124px;
        width: 100px;
        padding: 1px;
        border-radius: 3px;
        display: none;
    }
    .bar {background-color: green; display:block; width:0%; height:20px; border-radius: 3px; }
    .percent { position:absolute; height:20px; display:inline-block; top:3px; left:2%; color:#fff }
</style>
<script type="text/javascript" src="/static/js/jquery.form.js"></script>
</head>
<body>
  <include file="Public/common_header" />
  <div class="mian">
    <include file="Public/sidebar" menu='cwgl.fk' />
    <div class="mianR">
            <h3 class="yonghu">
                <if condition="$status eq 1">支付首款<elseif condition="$status eq 2"/>支付尾款<elseif condition="$status eq 3"/>付款明细</if>
            </h3>
            <div class="chezhu-xinxi">

                <div class="xinxi-conter xinxi-conter1" style="border: none;background: none">
                    <h4 class="order_no">车辆编号：<b>{$car.car_no}</b></h4>
                </div>
                <br/>
                <div class="xinxi-conter xinxi-conter1">
                    <h4>车辆信息</h4>
                    <ul>
                        <li class="clearfix">
                            <em>车型</em>
                            <em class="name-text1" style="width:300px;">{$car.model}</em>
                            <em>排放标准</em>
                            <em class="jing-text2">{$car.emission}</em>
                        </li>
                        <li class="clearfix">
                            <em>初登日期</em>
                            <em class="name-text1" style="width:300px;">{$car.first_reg_date}</em>
                            <em>颜色</em>
                            <em class="dian-hua">{$car.car_color}</em>
                        </li>

                        <li class="clearfix">
                            <em>表显里程</em>
                            <em class="name-text1" style="width:300px;">{$car.pointer_mileage}万公里</em>
                            <em>车况级别</em>
                            <em class="dian-hua">{$car.composite_state}{$car.accident_level}</em>
                        </li>

                        <li class="clearfix">
                            <em>车辆注册地</em>
                            <em class="name-text1" style="width:300px;">{$car.reg_city}</em>
                            <em>所在地</em>
                            <em class="name-text">{$car.location_area_str}</em>

                        </li>
                        <li class="clearfix">
                            <em>车牌号</em>
                            <em class="name-text1" style="width:300px;">{$car.plate_no}</em>
                            <em>车架号</em>
                            <em class="name-text" style="width:300px;">{$car.vin}</em>
                        </li>
                        <li class="clearfix">

                            <em>渠道来源</em>
                            <em class="name-text1" style="width:300px;">
                                <if condition="$car.comefrom neq ''">
                                <?php if(empty($car['comefrom_url'])):?>
                                    {$car.comefrom}
                                <?php else: ?>
                                  <a href="{$car.comefrom_url}" target="_blank" rel="noreferrer">{$car.comefrom}</a>
                                <?php endif;?>
                                <else/>
                                  未知
                                </if>
                            </em>
                            <em>竞拍结束时间</em>
                            <em class="jing-text2">{$order.bidding_end_time}</em>
                        </li>
                    </ul>
                </div>
                <br/>
                <?php if($car['car_source']==1):?>
                    <include file="Finance/pay_4s" />
                <?php else:?>
                    <include file="Finance/pay_person" />
                <?php endif;?>

                <if condition="$pay_info.pay_type eq 1">
                    <div class="xuanzhe">
                        <h4 class="yonghu">付款信息（{$order.order_no}）</h4>
                        <ul>
                            <li class="clearfix">
                                <span class="span_right">拍卖最高价：</span>
                                <span style="width: 100px;">{$order.best_price}元</span>
                            </li>
                            <li class="clearfix">
                                <span class="span_right">平台补贴：</span>
                                <?php if($car['is_dealer_breach']==1 && $pay_info['pay_type']==2):?>
                                    <span style="width:100px;">- -</span>
                                <?php else:?>
                                    <if condition="$order.is_consult eq 1">
                                        <span style="width: 100px;">{$order.company_subsidies} 元</span>
                                        <else />
                                        <span style="width: 100px;">0.00 元</span>
                                    </if>
                                <?php endif;?>
                            </li>
                            <li class="clearfix">
                                <span class="span_right">分享抬价：</span>
                                <span style="width:100px;">{$car.bid_up_price} 元</span>
                            </li>
                            <li class="clearfix">
                                <span class="span_right">车主降价：</span>
                                <span style="width: 100px;"><?php echo $order['depreciate'] > 0 ? $order['depreciate']." 元" : "0.00元" ;?></span>
                            </li>
                            <!--<li class="clearfix">-->
                                <!--<span class="span_right">检测费：</span>-->
                                <!--<span style="width: 100px;"><?php echo $car['check_fee'] > 0 ? $car['check_fee']." 元" : "0.00 元" ;?></span>-->
                            <!--</li>-->
                        </ul>
                        <div class="yt_total">
                            <if condition="$pay_info.pay_type eq 1">
                                <b style="font-size:16px;"><?php echo $pay_info['status']==0? "应" : "已" ;?>付首款</b>
                                {$order.formula} ：
                                <strong style="color: red;font-size:16px;">
                                    {$order.first_amount_total} 元
                                </strong>
                            </if>
                        </div>
                    </div>
                    <else />
                    <?php if($car['three_in_one'] == 1 && $car['is_dealer_breach'] != 1):?>
                        <div class="xinxi-conter xinxi-conter1">
                            <h4>首款信息（{$order.order_no}）</h4>
                            <ul>
                                <li class="clearfix">
                                    <em>拍卖最高价</em>
                                    <em class="name-text1" style="width:300px;">{$order.best_price} 元</em>
                                    <em>分享抬价</em>
                                    <em class="name-text">{$car.bid_up_price} 元</em>
                                </li>
                                <li class="clearfix">
                                    <em>公司补贴</em>
                                    <?php if($car['is_dealer_breach']==1 && $pay_info['pay_type']==2):?>
                                    <em class="name-text1" style="width:300px;">- -</em>
                                    <?php else:?>
                                    <if condition="$order.is_consult eq 1">
                                        <em class="name-text1" style="width:300px;">{$order.company_subsidies} 元</em>
                                        <else />
                                        <em class="name-text1" style="width:300px;">0.00 元</em>
                                    </if>
                                    <?php endif;?>
                                    <em>车主降价</em>
                                    <em class="dian-hua"><?php echo $order['depreciate'] > 0 ? $order['depreciate']." 元" : "0.00 元" ;?></em>
                                </li>
                                <li>
                                    <?php if($car['is_dealer_breach']==1 && $pay_info['pay_type']==2):?>
                                    <em>确认成交价格</em>
                                    <em class="name-text1" style="width:300px;"> - - </em>
                                    <?php else:?>
                                    <if condition="$order.is_consult eq 1">
                                        <em>磋商成交价</em>
                                        <em class="name-text1" style="width:300px;">{$order.success_price} 元</em>
                                        <else />
                                        <em>确认成交价</em>
                                        <em class="name-text1" style="width:300px;">{$order.success_price} 元</em>
                                    </if>
                                    <?php endif;?>
                                    <em>已付首款</em>
                                    <em class="name-text">{$order.first_money} 元</em>
                                </li>
                            </ul>
                        </div>
                        <br/>
                    <?php endif;?>

                    <div class="xinxi-conter xinxi-conter1">
                        <h4>尾款信息（{$order.order_no}）</h4>
                        <ul>
                            <?php if($car['is_dealer_breach']==1 && $pay_info['pay_type']==2):?>
                                <li class="clearfix">
                                    <em>拍卖最高价</em>
                                    <em class="name-text1" style="width:300px;">{$order.best_price} 元</em>
                                    <if condition="$pay_info.pay_type neq 1 AND $pay_info.status eq 0">
                                        <em>应付尾款</em>
                                        <em class="dian-hua">{$order.should_pay_tail_money} 元</em>
                                        <else/>
                                        <em>已付尾款</em>
                                        <em class="dian-hua">{$pay_info.amount} 元</em>
                                    </if>
                                </li>
                            <?php else:?>
                                <li class="clearfix">
                                    <em>拍卖最高价</em>
                                    <em class="name-text1" style="width:300px;">{$order.best_price} 元</em>
                                    <em>分享抬价</em>
                                    <em class="name-text">{$car.bid_up_price} 元</em>
                                </li>
                                <li class="clearfix">
                                    <em>平台补贴</em>
                                    <if condition="$order.is_consult eq 1">
                                        <em class="name-text1" style="width:300px;">{$order.company_subsidies} 元</em>
                                        <else />
                                        <em class="name-text1" style="width:300px;">0.00 元</em>
                                    </if>
                                    <em>车主降价</em>
                                    <em class="dian-hua"><?php echo $order['depreciate'] > 0 ? $order['depreciate']." 元" : "0.00 元" ;?></em>
                                </li>
                                <li>
                                    <if condition="$order.is_consult eq 1">
                                        <em>磋商成交价</em>
                                        <em class="name-text1" style="width:300px;">{$order.success_price} 元</em>
                                        <else />
                                        <em>确认成交价</em>
                                        <em class="name-text1" style="width:300px;">{$order.success_price} 元</em>
                                    </if>
                                    <if condition="$pay_info.pay_type neq 1 AND $pay_info.status eq 0">
                                        <em>应付尾款</em>
                                        <em class="name-text">{$order.tail_money} 元</em>
                                        <else/>
                                        <em>已付尾款</em>
                                        <em class="name-text">{$pay_info.amount} 元</em>
                                    </if>
                                </li>
                            <?php endif;?>
                        </ul>
                    </div>
                </if>
                <br/>

              <?php if(($pay_info['pay_type']==1 && $pay_info['status']==1) || $pay_info['pay_type']==2):?>
                <div class="xinxi-conter xinxi-conter1">
                    <h4>备注信息</h4>
                    <ul>
                        <if condition="$pay_info.status eq 1">
                            <li>
                                <em><if condition="$pay_info.pay_type eq 1">付首款<else/>付尾款</if>备注</em>
                                <em class="name-text">{$pay_info.remark}</em>
                            </li>
                        </if>
                        <if condition="$pay_info.pay_type eq 2">
                            <li>
                                <em>过户完成备注</em>
                                <em class="name-text">{$order.transfer_remark}</em>
                            </li>
                        </if>
                    </ul>
                </div>
              <?php endif;?>
              <?php if($car['car_source']==1  && !empty($payment_imgs)):?>
                <br/>
                <div class="xinxi-conter xinxi-conter1">
                    <h4>付款凭证</h4>
                    <?php foreach ($payment_imgs as $vo): ?>
                        <div class="box">
                            <div class="sunbox" >
                                <img src='<?php echo $host.$vo[url] ?>'  width=150 height=150>
                            </div>
                            <!-- <div class="files"></div> -->
                            <input type="hidden" value="{$order.order_id}" name="order_id" >
                            <input type="hidden" value="10"  name="type">
                        </div>
                    <?php endforeach ?>
                </div>
                <div style="clear: both"></div>
               <?php endif;?>
                <br/>
                <?php if($car['car_source']==1 && empty($payment_imgs)):?>
                <div class="xinxi-conter xinxi-conter1">
                    <h4>上传付款凭证</h4>
                    <?php foreach ($payment_imgs as $vo): ?>
                    <div class="box">
                        <div class="sunbox">
                            <img src='<?php echo $host.$vo[url] ?>@120h_156w'>
                        </div>
                        <div class="shangchuan" style="background-color:#b3b3b3">
                            <span>已上传</span>
                            <input id="" type="button" name="pic" onchange="upload_img(this);">
                        </div>
                        <div class="progress">
                            <span class="bar"></span><span class="percent">0%</span >
                        </div>
                        <div class="files">
                            <span class='delimg' img_id='<?php echo $vo[id] ?>' onclick='delimg(this)'>×</span>
                        </div>
                        <input type="hidden" value="{$order.order_id}" name="order_id" >
                    </div>
                    <?php endforeach ?>
                    <div class="box">
                        <div class="box-plus" onclick="add_box()">+</div>
                    </div>
                </div>
                <?php endif;?>
                <div style="clear: both"></div>
                <if condition="$pay_info.status eq 0">
                    <div class="xuanzhe" style="clear: both">
                        <ul>
                            <li class="clearfix remarks">
                               <span>备注</span>
                               <textarea id="remark"></textarea>
                            </li>
                        </ul>
                    </div>

                </if>
            </div>
            <if condition="$pay_info.status eq 0">
                <div class="yongBtn">
                    <input id="submit_pay" type="button" value="确认支付" class="queding" />
                    <input name="重置" type="reset" class="quxiao" onclick="history.back();" value="返回" />
                </div>
            <else />
                <div class="yongBtn1">
                    <input  type="button" class="quxiao" onclick="window.close()" value="关闭" />
                </div>
            </if>
        </div>
        <div class="clear"></div>
    </div>
  <div class="sunbox-alret">
      <span>×</span>
      <div class="xie-loading"><img src="http://img1.isou365.cn/paimai/yunying/images/loading.gif"></div>
      <img src="" />
  </div>
  <div class="pageBeijing" style="z-index:998;"></div>
    <script>

        $(document).ready(function() {
            $(".sunbox img").click(function(){
                var Img=$(this).attr("src").split("@");
                if(Img[0]==""){
                    $(".xie-loading").fadeIn();
                }else{
                    $(".xie-loading").hide();
                }
                $(".pageBeijing").css("display","block");
                $(".sunbox-alret img").attr("src",Img[0]).get(0).onload=function(){
                    $(".sunbox-alret").fadeIn();
                    $(".sunbox-alret").css({
                        "marginTop":-$(".sunbox-alret").outerHeight()/2,
                        "marginLeft":-$(".sunbox-alret").outerWidth()/2,
                    })
                };
            })
            $(".sunbox-alret span").click(function(){
                $(".pageBeijing").css("display","none");
                $(".sunbox-alret").fadeOut();
            })

        });
        $("#submit_pay").click(function(){
            var remark = $("#remark").val();
            var post_data = {
                "remark": remark,
                'pay_id': "<?php echo $pay_info['pay_id'];?>"
            };
            $(".yunBei").css("display","block").unbind("click");
            $(".loading").fadeIn();
            $.post("/Finance/<?php echo $pay_info['pay_type']==1 ? 'pay_first' : 'pay_tail' ;?>",post_data,function(data){
                if(data.code!==200){
                    $(".loading").fadeOut()
                    $(".yunBei").css("display","none")
                    shibai_alert(data.msg,1500);
                    return false;
                }
                btn_alert("确认成功",1500,function(){
                       location.href = document.referrer
                });
            },"json");
        });


    </script>
  <script type="text/javascript">
      function upload_img(obj){
          var box = $(obj).parent().parent('.box');
          var sunbox = $(obj).parent().siblings(".sunbox");
          var files = $(obj).parent().siblings(".files");
          var btn = $(obj).siblings("span");
          var progress = $(obj).parent().siblings(".progress");
          var bar =  $(obj).parent().siblings(".progress").children('.bar');
          var percent =  $(obj).parent().siblings(".progress").children('.percent');
          box.wrap("<form id='myupload' action='/Finance/add_payment_img' method='post' enctype='multipart/form-data'></form>");
          $("#myupload").ajaxSubmit({
              dataType:  'json',
              beforeSend: function() {
                  sunbox.empty();
                  progress.show();
                  var percentVal = '0%';
                  bar.width(percentVal);
                  percent.html(percentVal);
                  btn.html("上传中...");
                  // $(obj).attr('type','botton');
                  $(obj).parent().css("background-color","#b3b3b3");
              },
              uploadProgress: function(event, position, total, percentComplete) {
                  var percentVal = percentComplete + '%';
                  bar.width(percentVal);
                  percent.html(percentVal);
              },
              success: function(data) {
                  if (data.code == 200) {
                      progress.hide();
                      files.html("<span class='delimg' img_id='"+data.data.img_id+"' onclick='delimg(this)'>×</span>");
                      var img = data.data.pic+"@120h_156w";
                      sunbox.html("<img src='"+img+"'>");
                      btn.html("已上传");
                      btn.parent(".shangchuan").css("cursor","default");
                      btn.siblings("#fileupload").css("cursor","default");
                      $(obj).attr('type','botton');
                      $(obj).parent().css("background-color","#b3b3b3");
                      sunbox.css('background','none');
                      sunbox.css('background-color','#d3d9d9');

                      $(".sunbox img").click(function(){
                          var Img=$(this).attr("src").split("@");
                          if(Img[0]==""){
                              $(".xie-loading").fadeIn();
                          }else{
                              $(".xie-loading").hide();
                          }
                          $(".pageBeijing").css("display","block");
                          $(".sunbox-alret img").attr("src",Img[0]).get(0).onload=function(){
                              $(".sunbox-alret").fadeIn();
                              $(".sunbox-alret").css({
                                  "marginTop":-$(".sunbox-alret").outerHeight()/2,
                                  "marginLeft":-$(".sunbox-alret").outerWidth()/2,
                              })
                          };
                      })
                      $(".sunbox-alret span").click(function(){
                          $(".pageBeijing").css("display","none");
                          $(".sunbox-alret").fadeOut();
                      })

                  }else{
                      progress.hide();
                      btn.html("上传");
                      $(obj).attr('type','file');
                      $(obj).parent().css("background-color","#5bb75b");
                      shibai_alert(data.msg,2000);
                  }
                  box.unwrap("<form id='myupload' action='/Transfer/add_transfer_img' method='post' enctype='multipart/form-data'></form>");;
              },
              error:function(xhr){
                  xhr.responseText = "图片过大";
                  progress.hide();
                  btn.html("上传");
                  $(obj).attr('type','file');
                  $(obj).parent().css("background-color","#5bb75b");
                  //shibai_alert(xhr.responseText,2000);
                  box.unwrap("<form id='myupload' action='/Transfer/add_transfer_img' method='post' enctype='multipart/form-data'></form>");;
              },
              clearForm: true
          });
      }


      function delimg(obj){
          confirmAAA('<div style="color:red">您确定删除图片？</div>', confirm11);
          function confirm11() {
              $('.determine').click(function() {
                  colse_hide();
                  delimg_action(obj);
              });
          }
      }

      function confirmAAA(text,callback){
          var html='<div class="chenggong1"><span class="paidan">'+text+'</span><div class="shenhei-btn"><input type="button" value="确定" class="determine" /><input type="button" value="取消" class="cancel" onclick="colse_hide()" /></div></div>'
          $(".yunBei").css("display","block");
          $(document.body).append(html);
          $(".chenggong1").css("display","block");
          if(typeof(callback)!="undefined"){
              callback();
          }
      }
      function colse_hideA(){
          $(".yunBei").css("display","none");
          $(".chenggong1").fadeOut('slow',function(){
              $(".chenggong1").remove();
          });
      }


      function delimg_action(obj){
          var img_id = $(obj).attr("img_id");
          var sunbox = $(obj).parent().siblings(".sunbox");
          var files = $(obj).parent(".files");
          var shangchuan = $(obj).parent().siblings(".shangchuan");
          $.post("/Finance/del_voucher_img",{img_id:img_id},function(res){
              if(res.code==200){
                  sunbox.html("");
                  files.html("");
                  files.children('.delimg').css("display","none");
                  shangchuan.css("background-color","#5bb75b");
                  shangchuan.children("span").html("上传");
                  shangchuan.children("#fileupload").attr('type','file');
                  sunbox.removeAttr("style");

              }else{
                  delay_alert(res.msg);
              }
          },'json');
      }

      function add_box(){
          var addbox = $('.box-plus').parent('.box');
          $(addbox).before('<div class="box"><div class="sunbox"></div><div class="shangchuan"><span>上传</span><input id="fileupload" type="file" name="pic" onchange="upload_img(this);"></div><div class="progress"><span class="bar"></span><span class="percent">0%</span ></div><div class="files"></div><input type="hidden" value="{$order.order_id}" name="order_id" ><input type="hidden" value="10"  name="type"></div>');

      }



  </script>
<include file="Public/foot" />
